---
title: Lua Reference - kong.plugins.basic-auth.crypto
layout: default
---


<header class="page-header">
  <div class="container">
    <div class="page-header-icon">
      <img src="/assets/images/icons/icn-documentation.svg" alt="Documentation" />
    </div>
    <div class="page-header-title">
      <h1>Public Lua API Reference</h1>
      <p>For plugins developers and core contributors</p>
    </div>
    {% if site.data.kong_versions.size > 1 %}
      {% include lua-reference-dropdown.html
        page=page
        site=site
      %}
    {% endif %}
  </div>
</header>

<div class="container">
  <aside class="page-navigation">
    <nav>
      <ul>
        <li>
          <a href="/{{page.kong_version}}"><h5>Back to docs</h5></a>
        </li>
        <li>
          <a href="/{{page.kong_version}}/lua-reference/"><h5>Index</h5></a>
        </li>
        <li>
          <h5>Modules</h5>
          <ul>
            <li><a href="../../modules/kong.dao">kong.dao</a></li>
            <li>kong.plugins.basic-auth.crypto</li>
            <li><a href="../../modules/kong.plugins.galileo.alf">kong.plugins.galileo.alf</a></li>
            <li><a href="../../modules/kong.plugins.galileo.buffer">kong.plugins.galileo.buffer</a></li>
            <li><a href="../../modules/kong.plugins.jwt.jwt_parser">kong.plugins.jwt.jwt_parser</a></li>
            <li><a href="../../modules/kong.tools.responses">kong.tools.responses</a></li>
            <li><a href="../../modules/kong.tools.timestamp">kong.tools.timestamp</a></li>
            <li><a href="../../modules/kong.tools.utils">kong.tools.utils</a></li>
            <li><a href="../../modules/spec.helpers">spec.helpers</a></li>
          </ul>
        </li>
      </ul>
    </nav>
  </aside>

  <div class="page-content-container">
  <div class="page-content">
    <div class="content">
<h1><code>kong.plugins.basic-auth.crypto</code></h1>
<p>Salt the password
 Password is salted with the credential's consumer_id (long enough, unique)</p>
<p></p>



<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
  <tr>
    <td class="name"><a href="#encrypt">encrypt (credential)</a></td>
    <td class="summary">Encrypt the password field credential table</td>
  </tr>
</table>


<h2 class="section-header "><a name="Functions">Functions</a></h2>


<dl class="function">
  <hr />
  <dt>
    <h4><a name="encrypt">encrypt</a></h4>
  </dt>
  <dd>
    Encrypt the password field credential table

    <h5>Parameters:</h5>
    <ul>
        <li>
          <code class="parameter">credential</code>
          The basic auth credential table
        </li>
    </ul>

    <h5>Returns:</h5>
    <ul>
      <li>
        hash of the salted credential's password
      </li>
    </ul>





  </dd>
</dl>


    </div>
  </div>
</div>
</div>
